package com.apes.auto.car.service;

import com.apes.auto.car.model.CarSeries;
import com.apes.auto.car.repository.CarSeriesRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName CarSeriesService
 * @Description TODO
 * @Author pengyb
 * @Date 2019/7/11 10:34
 * @Version 1.0
 **/
@Service("carSeriesService")
public class CarSeriesService extends DomainService {
    @Autowired
    private CarSeriesRepository carSeriesRepository;

    public CarSeries save(SimpleRequest request) {
        CarSeries o = request.getO(CarSeries.class);
        return carSeriesRepository.save(o);
    }

    public String delete(SimpleRequest request) {
        CarSeries o = request.getO(CarSeries.class);
        carSeriesRepository.delete(o.getId());
        return "删除成功";
    }

    public List<CarSeries> BatchSave(Iterable<CarSeries> carSeries) {
        return carSeriesRepository.save(carSeries);
    }
}
